<?php
class addAction extends rareAction{
	public function execute(){
		$type = $this->getGetParam('type',0);
		$this->assign('type',$type);
		if(!Tool::_getCache('isAdmin')&&in_array($type,array(service_type::BANNER,service_type::SLIDE))){
			Tool::_setCache('currentID',service_menu::getCurrent('1',$type));
		}
	}
	public function executePost(){
		$banner = $this->getPostParam('banner',array());
		$images = $this->getPostParam('img',array());
		if(empty($banner)) jsonReturn(0,'添加失败');
		if(!empty($images)){
			service_image::insert($images,$banner['typeID'],0,$banner['title'],$banner['url'],$banner['sortID']);
		}
		jsonReturn(1,'ok');
	}
}
?>
